package br.com.timesystem.model;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.Index;

/**
 *
 * @author duduso
 */
@Entity
@Table(name = "lancamento")
public class Lancamento extends EntityBase{
    
    @Id
    @SequenceGenerator(name = "gen_id_lanc", sequenceName = "gen_id_lanc", allocationSize = 1)
    @GeneratedValue(generator = "gen_id_lanc")        
    @Column(name = "id_lancamento", unique = true, nullable = false)    
    @Index(name = "idx_id_lanc")
    private Long id;            
    
    @Temporal(TemporalType.DATE)
    @Column(name = "data_lancamento", nullable = false)    
    private Date dataLancamento;
    
    @ManyToOne(optional = false)
    @JoinColumn(name = "id_proj_colab")
    @ForeignKey(name = "fk_id_proj_colab")                
    private ProjetoColaborador projetoColaborador;

    public Lancamento() {
    }

    public Lancamento(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getDataLancamento() {
        return dataLancamento;
    }

    public void setDataLancamento(Date dataLancamento) {
        this.dataLancamento = dataLancamento;
    }

    public ProjetoColaborador getProjetoColaborador() {
        return projetoColaborador;
    }

    public void setProjetoColaborador(ProjetoColaborador projetoColaborador) {
        this.projetoColaborador = projetoColaborador;
    }
    
}
